// src/api/file/index.ts
import request from '@/utils/request'

/**
 * 上传文件
 *
 * @param file
 */
export const uploadFileApi = (file: any, id: any, type: any) => {
  const formData = new FormData()
  formData.append('file', file)
  formData.append('id', id)
  formData.append('type', type)
  return request({
    url: '/manager/investment/file/upload',
    method: 'post',
    data: formData,
    headers: {
      'Content-Type': 'multipart/form-data',
    },
  })
}

/**
 * 删除文件
 *
 * @param filePath 文件完整路径
 */
export const deleteFileApi = (filePath: any) => {
  return request({
    url: '/manager/energy/common/upload',
    method: 'delete',
    params: { filePath: filePath },
  })
}
